Skip to content

docs: make version selector keyboard accessible - #2726

Open
kfenner wants to merge 1 commit into
mainfrom
kaspar-fenner-docs-version-selector-click
Open

docs: make version selector keyboard accessible#2726
kfenner wants to merge 1 commit into
mainfrom
kaspar-fenner-docs-version-selector-click

Conversation

@kfenner

@kfenner kfenner commented Sep 4, 2026

Copy link
Copy Markdown
Member

Description

Follow-up to #2723. The click-only version selector could not be opened or operated with the keyboard because the hover override also disabled Material's :focus-within path.

This implements a WAI-ARIA disclosure navigation pattern (same class of control as MDN / many docs version switchers):

  • Native button with aria-expanded / aria-controls (no aria-haspopup)
  • Real links in a ul, hidden when closed, aria-current="page" on the current version
  • Click to toggle; hover does not open
  • Tab into the list when open; Arrow / Home / End; Escape closes and returns focus
  • Dropdown sits below the button so a second click closes instead of activating a version
  • Panel is lifted from the header so it remains readable in light and dark

Tested by injecting the new CSS/JS into https://element.siemens.io/development/ (click, click-again, hover, Tab, arrows, Escape, ARIA, light/dark).

Backports to v49 and v48 are intentionally not included yet.

Testing

  • Injected CSS/JS against live development docs
  • Docs build on this branch (reviewer)

Documentation.
Examples.
Dashboards Demo.
Playwright report.

Coverage Reports:

Code Coverage

Replace the click-only override with a WAI-ARIA disclosure navigation
pattern so the docs version switcher is operable by mouse and keyboard.

The previous hover disable also removed Material's :focus-within open
path, so Tab never reached the list. The button now uses aria-expanded
and aria-controls, the list is hidden until open, and Tab, arrows,
Home/End, and Escape move through the real version links.

Position the dropdown below the toggle so a second click closes it
instead of activating a version, and lift the panel from the header.
@kfenner
kfenner marked this pull request as ready for review September 10, 2026 19:39
@kfenner
kfenner requested review from a team as code owners September 10, 2026 19:39
@kfenner kfenner added this to the 51.x milestone Sep 10, 2026
@kfenner kfenner added the documentation Improvements or additions to documentation label Sep 10, 2026
@kfenner

kfenner commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

@chintankavathia @dr-itz Could somebody merge me this? It's bugging me and I want to see if this might fix the current behavior. When the behavior is good, we can backport to v49, v48.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant